<?php

require_once 'db.php';
require_once 'config/config.php';

class works extends db {

    public $bd;
    public $end;

    public function select() {
        $this->connect();
        $query = "SELECT * FROM works LIMIT $this->bd, $this->end";
        $works = $this->query($query);
        return $works;
    }  
    
    public function count() {
        $this->connect();
        $query = "SELECT * FROM works";
        $works = $this->query($query);
        return count($works);
    }
    
      public function login($id=null, $page= null) {
        $this->connect();
        $where = "";  
        if(!empty($id))
        $where = "where id = $id";
        $limit ="";
        if(!empty($page))
        $limit='limit' . $loin . ',' .PER_PAGE;
        $loin=($page-1)*PER_PAGE;
        $query = "SELECT * FROM works $where $limit";
        $works = $this->query($query);
        return $works;
    }

}

?>